package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.BankInfoMapper;
import com.ly.heart.domain.BankEntity;
import com.ly.heart.service.IBankInfoService;

import javax.annotation.Resource;

/**
 * 客户/供应商银行账号信息Service业务层处理
 *
 * @author cxl
 * @date 2024-05-14
 */
@Service
public class BankInfoServiceImpl extends ServiceImpl<BankInfoMapper,BankEntity> implements IBankInfoService
{
    @Resource
    private BankInfoMapper bankMapper;

    /**
     * 查询客户/供应商银行账号信息
     *
     * @param id 客户/供应商银行账号信息主键
     * @return 客户/供应商银行账号信息
     */
    @Override
    public BankEntity selectBankEntityById(String id)
    {
        return bankMapper.selectBankEntityById(id);
    }

    /**
     * 查询客户/供应商银行账号信息列表
     *
     * @param bankEntity 客户/供应商银行账号信息
     * @return 客户/供应商银行账号信息
     */
    @Override
    public List<BankEntity> selectBankEntityList(BankEntity bankEntity)
    {
        return bankMapper.selectBankEntityList(bankEntity);
    }

    /**
     * 新增客户/供应商银行账号信息
     *
     * @param bankEntity 客户/供应商银行账号信息
     * @return 结果
     */
    @Override
    public int insertBankEntity(BankEntity bankEntity)
    {
        bankEntity.setId(SnowflakeIdWorker.getInstance ().nextStringId ());
        bankEntity.setCreateTime(DateUtils.getNowDate());
        return bankMapper.insertBankEntity(bankEntity);
    }

    /**
     * 修改客户/供应商银行账号信息
     *
     * @param bankEntity 客户/供应商银行账号信息
     * @return 结果
     */
    @Override
    public int updateBankEntity(BankEntity bankEntity)
    {
        return bankMapper.updateBankEntity(bankEntity);
    }

    /**
     * 批量删除客户/供应商银行账号信息
     *
     * @param ids 需要删除的客户/供应商银行账号信息主键
     * @return 结果
     */
    @Override
    public int deleteBankEntityByIds(String[] ids)
    {
        return bankMapper.deleteBankEntityByIds(ids);
    }

    /**
     * 删除客户/供应商银行账号信息信息
     *
     * @param id 客户/供应商银行账号信息主键
     * @return 结果
     */
    @Override
    public int deleteBankEntityById(String id)
    {
        return bankMapper.deleteBankEntityById(id);
    }
}
